/**
 * 
 */
package cn.edu.cqu.bysj.wm.util;

/**
 * @author Meng
 *
 */
import java.io.File;

public class DeleteDirectory {

	private static String path;

	/**
	 * delete directory of the datebase
	 * 
	 * @param dir
	 */
	public static void deleteDirectory(File dir) {
		path = dir.getPath();
		if (dir.getName().equals("messages.log"))
			return;
		if (dir.isDirectory()) {
			String[] children = dir.list();
			for (int i = 0; i < children.length; i++) {
				deleteDirectory(new File(dir, children[i]));
			}
		}
		if (!dir.getName().equals(path)) {
			dir.delete();
		}
	}

}
